"""
@Project:p8project
@File:jwt_auth.py
@Author:袁浩天
@Date:18:50
"""
from flask import request, g
from common.utils.login_token import check_token


def jwt_authorization():
    token = request.headers.get('Authorization')
    if token and token.statswith('JWT'):
        token  = token[4:]
        payload = check_token(token)

        if payload:
            g.user_id = payload.get("user_id")


